/**
 * 
 */
package org.wicket.jbpm.engine.handlers;

import org.jbpm.graph.def.ActionHandler;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.access.BeanFactoryLocator;
import org.springframework.beans.factory.access.BeanFactoryReference;
import org.springmodules.workflow.jbpm31.JbpmFactoryLocator;

/**
 * @author Emmanuel Nollase - emanux 
 * created: Jun 24, 2009 - 2:45:55 PM
 */
public abstract class SpringActionHandler implements ActionHandler
{

    public SpringActionHandler()
    {
	// The following implementation is derived from Spring Modules v0.4
	BeanFactoryLocator factoryLocator = new JbpmFactoryLocator();
	BeanFactoryReference factory = factoryLocator.useBeanFactory(null);
	initialiseHandler(factory.getFactory());
    }

    /**
     * Initialise Action Handler
     * 
     * @param factory
     *            Spring bean factory for accessing Alfresco beans
     */
    protected abstract void initialiseHandler(BeanFactory factory);
}
